import 'package:aio/aio.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:app/generated/app_strings.dart';
import 'package:app/src/http/bean/wroks/contract_bean.dart';
import 'package:app/src/http/bean/wroks/customers_copyInfo.dart';
import 'package:app/src/ui/app_ui.dart';
import 'package:app/src/ui/route/works/public/items/ui_base.dart';
import 'package:app/src/ui/route/works/public/items/ui_card.dart';
import 'package:app/src/utils/image_path_utils.dart';

///客户信息
class UiCustomersInfo {
  ///data 客户信息
  ///oldData 历史客户信息
  static Widget build(BuildContext context, CustomersCopyInfo? data,
      CustomersCopyInfo? oldData) {
    if (StringUtils.isEmpty(data)) {
      return AppUi.getEmptyView();
    }
    List<Widget> children = [];
    children.add(
        UiBase.title(context, AppStrings.of(context).CustomerInformation)); //标题
    children.add(UiBase.item(context, AppStrings.of(context).CustomerCode,
        data?.CustomerCode, oldData?.CustomerCode)); //客户编号
    children.add(UiBase.item(context, AppStrings.of(context).CustomerName,
        data?.CustomerName, oldData?.CustomerName)); //客户名称
    children.add(UiBase.item(context, AppStrings.of(context).CustomerAddress,
        data?.CustomerAddress, oldData?.CustomerAddress)); //注册地址
    children.add(UiBase.item(context, AppStrings.of(context).CustomerLinkman,
        data?.CustomerLinkman, oldData?.CustomerLinkman)); //法人代表
    children.add(UiBase.item(context, AppStrings.of(context).CustomerTelephone,
        data?.CustomerTelephone, oldData?.CustomerTelephone)); //固定电话
    children.add(UiBase.item(context, AppStrings.of(context).Email,
        data?.Email, oldData?.Email)); //电子邮箱
    children.add(UiBase.item(context, AppStrings.of(context).Fax,
        data?.Fax, oldData?.Fax)); //传真
    var column = UiBase.column(context, children);
    var card = UiCard.build(context, column);
    return card;
  }
}
